;C:ANGL - place line at an angle to selection. Requires ROTX.LSP, UPOINT.LSP, UANGLE.LSP.
;
;	AUTHOR: Henry C. Francis
;		425 N. ASHE ST.
;		SOUTHERN PINES, N.C. 28387
;		All rights reserved without prejudice.
;
;	Copyright:	5-14-93
;	Edited:		5-4-00
;
(defun C:ANGL ( / );e0ang e1ang e2ang pt2 andr vdis osmode celtype cecolor snapang)
       (setq aperture (getvar "APERTURE")
             osmode (getvar "OSMODE")
             celtype (getvar "CELTYPE")
             cecolor (getvar "CECOLOR")
             snapang (getvar "SNAPANG"))
       (setvar "CMDECHO" 0)
;       (setvar "OSMODE" 0)
       (setvar "APERTURE" 5)
       (setq pt1 (getpoint "\nPoint to Turn from"))
       (if rotx nil (load"rotx" "\nROTX.LSP not found! "))
       (rotx pt1)
;       (setvar "OSMODE" 512)
       (if upoint nil (load"upoint" "\nFile UPOINT.LSP not found! "))
       (setq pt2 (upoint 1 "" "Vector to Turn from" nil pt1))
;       (setvar "OSMODE" 0)
       (if uangle nil (load"uangle" "\nUANGLE.LSP not found! "))
       (setq e1ang (uangle 1 "" "Angle to Turn" nil pt1))
	     (setq vdis (distance pt1 pt2))
	     (setq e2ang (angle pt1 pt2))
	     (setq e0ang (+ e1ang e2ang))
	     (setq andr (strcat "@" (rtos vdis) "<" (angtos e0ang)))
	     (command ".line" pt1 andr "")
       (if (eq "(" (substr cecolor 3 1)) (setq cecolor (substr cecolor 1 1)))
       (setvar "APERTURE" aperture)
       (setvar "OSMODE" osmode)
       (setvar "SNAPANG" snapang)
       (command ".linetype" "s" celtype ""
                ".color" cecolor)
       (princ)
);defun C:ANGL
(defun C:ANGL90 ( / );e0ang e1ang e2ang pt2 andr vdis osmode celtype cecolor snapang)
  (VL-LOAD-COM)
  (SETQ this-ename
         (CAR (ENTSEL "\nSelect 2D Polyline: ") ;_ end of ENTSEL
         ) ;_ end of CAR
  ) ;_ end of SETQ
  (SETQ this-object (VLAX-ENAME->VLA-OBJECT this-ename))
  (SETQ this-obj-name (VLAX-GET this-object 'ObjectName))
  (IF (EQ this-obj-name "AcDb2dPolyline")
    (PROGN
      (SETQ coords (VLAX-GET this-object 'Coordinates))
      (setq cnt 2
            coord_lst NIL
      )
      (WHILE (< cnt (LENGTH coords))
        (SETQ coord_lst (APPEND coord_lst (LIST (LIST (NTH (- cnt 2) coords)(NTH (- cnt 1) coords)(NTH cnt coords))))
              cnt (+ cnt 3)
        )
      )
      (foreach n coord_lst
        (if (EQ n (LAST coord_lst))
          (command ".line" n (polar n (+ (angle (nth 1 (reverse coord_lst)) n) (* PI 1.5)) 100.0) "")
          (command ".line" n (polar n (+ (angle (nth 1 (member n coord_lst)) n) (* PI 0.5)) 100.0) "")
        )
      )
    )
  )
  (PRINC)
);defun C:ANGL90

